/*
  @ vue3不建议使用mixin，改为使用组合式API
 */
import { ref, onMounted, onUnmounted } from "vue";
export function useMouse ()
 {
  const x = ref<string|number>('0')
  const y = ref<string|number>('0')
  const mouseOn = (event:any) => {
    console.log()
    x.value = event.pageX,
    y.value = event.pageY
  }
  onMounted(()=>{window.addEventListener('mousemove', mouseOn)})
  onUnmounted(()=>{window.addEventListener('mousemove', mouseOn)})
  return {x,y}
}
